﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:BingMapsToolkit="clr-namespace:DeepEarth.BingMapsToolkit.Client.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/DeepEarth.BingMapsToolkit.Client.Common;component/Resources/CommonStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="BingMapsToolkit:ToolPanel">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="BingMapsToolkit:ToolPanel">
                    <Canvas x:Name="LayoutRoot" Opacity="0.82" Width="260" Height="25">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.3000000"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal">
                                    <Storyboard/>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="OptionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.6000000"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Open">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="OptionsFlyout" Storyboard.TargetProperty="(FrameworkElement.Height)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="140"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="OptionsFlyout" Storyboard.TargetProperty="(Canvas.Top)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-138"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.6" Storyboard.TargetName="PART_HideShowOptions" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5999999" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.6000000" Value="180"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Closed">
                                    <Storyboard/>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border Width="260" Height="25" HorizontalAlignment="Stretch" Background="#FF2B2B2B" BorderBrush="#FF000000" BorderThickness="1,1,1,1" Canvas.ZIndex="2">
                            <ContentPresenter Margin="20,0,20,0" 
                                    Width="200"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}" />
                        </Border>

                        <ContentControl Content="{StaticResource EndPath}" Canvas.Left="0" Height="25" RenderTransformOrigin="0.5,0.5" ContentTemplate="{StaticResource EndPath}" Canvas.ZIndex="3">
                            <ContentControl.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="1"/>
                                    <SkewTransform/>
                                    <RotateTransform Angle="180"/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ContentControl.RenderTransform>
                        </ContentControl>

                        <ContentControl Content="{StaticResource EndPath}" Canvas.Left="245" Height="25" RenderTransformOrigin="0.5,0.5" ContentTemplate="{StaticResource EndPath}" Canvas.ZIndex="3">
                            <ContentControl.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="1"/>
                                    <SkewTransform/>
                                    <RotateTransform Angle="0"/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ContentControl.RenderTransform>
                        </ContentControl>
                        
                        <Button x:Name="PART_HideShowOptions" Style="{StaticResource ButtonStyle}" Canvas.Left="235" Canvas.Top="4" Canvas.ZIndex="4" Height="16" Content="^" RenderTransformOrigin="0.5,0.5" Padding="1" >
                            <Button.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </Button.RenderTransform>
                        </Button>
                        
                        <Grid Height="0" x:Name="OptionsFlyout" Width="240" Margin="10,0,10,25" Canvas.ZIndex="1">
                            <Border HorizontalAlignment="Stretch" Margin="5,0,5,0" Background="#FF2B2B2B" BorderBrush="#FF000000" BorderThickness="1,1,1,1" VerticalAlignment="Stretch">
                                <ContentPresenter Margin="8,8,8,8"
                                    Content="{TemplateBinding Options}"
                                    ContentTemplate="{TemplateBinding OptionsTemplate}" />
                            </Border>
                        </Grid>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

